﻿using AFS.VisitationRequestTool.Addin.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace AFS.Visitation.Addin.Tests
{


    /// <summary>
    ///This is a test class for XsnToFormRegionConverterTest and is intended
    ///to contain all XsnToFormRegionConverterTest Unit Tests
    ///</summary>
    [TestClass()]
    public class XsnToFormRegionConverterTest
    {

        private TestContext testContextInstance;
        private XsnToFormRegionConverter converter;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        [ClassInitialize()]
        public static void MyClassInitialize(TestContext testContext)
        {
            // testContext.Properties["XsnToFormRegionConverter"] = new XsnToFormRegionConverter();           
        }

        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        [TestInitialize()]
        public void MyTestInitialize()
        {
            VisualStudioHelper.VstHelper.VstClearOutputWindow();

            converter = new XsnToFormRegionConverter();
            converter.FetchVisitationRequestXSN();
            converter.ExtractVisitationRequestXSNContents();
        }
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for FetchVisitationRequestXSN
        ///</summary>
        //[TestMethod()]
        //public void FetchVisitationRequestXSNTest()
        //{           
        //    //System.IO.FileStream fetchedFile = converter.FetchVisitationRequestXSN();
        //    //converter = (XsnToFormRegionConverter)testContextInstance.Properties["XsnToFormRegionConverter"];
        //    converter.FetchVisitationRequestXSN();
        //    Assert.IsNotNull(converter, "Template fetched");
        //}

        /// <summary>
        ///A test for ExtractVisitationRequestXSNContents
        ///</summary>
        //[TestMethod()]
        //public void ExtractVisitationRequestXSNContentsTest()
        //{            
        //    //int expected = 0; // TODO: Initialize to an appropriate value
        //    int actualNumberOfFilesExtracted;           
        //    converter.ExtractVisitationRequestXSNContents();
        //    actualNumberOfFilesExtracted = System.IO.Directory.GetFiles(converter.ExtractedContentsPath).Length;
        //    Assert.IsTrue(actualNumberOfFilesExtracted > 0, "Contents extracted.");            
        //}

        /// <summary>
        ///A test for GetRequestLibrarySchema
        ///</summary>
       

        [TestMethod()]
        public void ParseRequestLibrarySchemaTest()
        {
            System.IO.Stream xsdLog = converter.ParseRequestLibrarySchema();
            Assert.IsNotNull(xsdLog);
        }

    }
}
